JSBool JS_ValueToObject()

Description Extracts a function argument from a jsval, converts it to an object (if possible), and passes the converted value back to the caller. If the object is an array, use JS_GetArrayLength() and JS_GetElement() to read its contents.
Arguments JSContext *cx, jsval v, JSObject **op
cx is the opaque JSContext pointer that was passed to the JavaScript function.
v is the jsval from which the string is to be extracted.
op is a pointer to a (JSObject *). This function stores the converted value in *op.
Returns A Boolean value indicating success (JS_TRUE) or failure (JS_FALSE).